using DataDynamics.ActiveReports;
using DataDynamics.ActiveReports.Export.Xls;
using SM.core;
using SS;
using SS.core;
using SS.dir;
using System;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
namespace TVSBH.func
{
	public class frmInventory : Form
	{
		private Func objFunc = new Func();
		private DataTable objTable = new DataTable();
		private Bill objBill = new Bill();
		private string strConnection = "";
		private string currPossName = "";
		private string currPid = "0";
		private bool isPostBack = false;
		private frmWaitting objW;
		private IContainer components = null;
		private DataGridView dgvProduct;
		private Button btnClose;
		private GroupBox groupBox1;
		private ComboBox cbbParentGID;
		private System.Windows.Forms.Label label1;
		private Button btnPrint;
		private System.Windows.Forms.Label label4;
		private DateTimePicker txttoDay;
		private System.Windows.Forms.Label label3;
		private DateTimePicker txtfromDay;
		private System.Windows.Forms.TextBox txtSearch;
		private Button btnExportToExcel;
		private System.Windows.Forms.Label lblCountItem;
		private System.Windows.Forms.CheckBox ckbShowPossName;
		private TreeView tvPossition;
		private ImageList imageList1;
		private ComboBox cbbPossition;
		private System.Windows.Forms.Label label5;
		private Button btnForward;
		private System.Windows.Forms.Label lblCurrPoss;
		private System.Windows.Forms.Label lblSumMoney;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.Label label6;
		private Button btnSearch;
		private DataGridViewTextBoxColumn Column2;
		private DataGridViewTextBoxColumn Column1;
		private DataGridViewTextBoxColumn Column4;
		private DataGridViewTextBoxColumn Column8;
		private DataGridViewTextBoxColumn Column5;
		private DataGridViewTextBoxColumn Column6;
		private DataGridViewTextBoxColumn Column7;
		private DataGridViewTextBoxColumn Column3;
		private DataGridViewTextBoxColumn Column9;
		private DataGridViewTextBoxColumn PossName;
		private System.Windows.Forms.Label label2;
		public frmInventory()
		{
			this.InitializeComponent();
		}
		private void frmInput_Load(object sender, EventArgs e)
		{
			Program.strConnectionString = this.objFunc.strConnectionString;
			this.loadPossition();
			this.objFunc.LoadComboBoxGProduct("SELECT GpID, UPPER(GpName) AS GpName FROM TabGproducts ORDER BY GpName", this.cbbParentGID, "GpID", "GpName");
			this.objFunc.LoadComboBox("SELECT ID, UPPER(Name) AS Name FROM TabPossition ORDER BY Name", this.cbbPossition, "ID", "Name");
			this.dgvProduct.AutoGenerateColumns = false;
			this.isPostBack = true;
		}
		private void btnClose_Click(object sender, EventArgs e)
		{
			base.Close();
		}
		private void frmInput_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Escape)
			{
				base.Close();
			}
			else
			{
				if (e.KeyCode == Keys.F7)
				{
					this.btnPrint.PerformClick();
				}
			}
		}
		private void btnPrint_Click(object sender, EventArgs e)
		{
		}
		private void cbbParentGID_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (this.cbbParentGID.SelectedValue.ToString() != "0")
			{
				string text = "";
				if (this.currPossName.Trim() != "")
				{
					text = " AND [PossName] = N'" + this.currPossName + "'";
				}
				this.getDetailBalancer(string.Concat(new string[]
				{
					"SELECT * FROM [TabDetailBill],[TabBill] WHERE [TabDetailBill].[billID] = [TabBill].[ID] AND  [TypeInput] IN ('IN1','IN2','IN3') AND [TabBill].[CreateDate] BETWEEN @objDate1 AND @objDate2 AND [TabDetailBill].[Pid] IN (SELECT [Pid] FROM [TabProducts] WHERE [GpID] = ",
					this.cbbParentGID.SelectedValue.ToString(),
					") ",
					text,
					" ORDER BY [ProductName]"
				}));
			}
			else
			{
				this.getDetailBalancer("");
			}
		}
		public void getDetailBalancer(string sqlQuery)
		{
			try
			{
				DataTable dataTable = new DataTable();
				DataColumn column = new DataColumn("Pid", typeof(string));
				DataColumn column2 = new DataColumn("ProductName", typeof(string));
				DataColumn column3 = new DataColumn("Packet", typeof(string));
				DataColumn column4 = new DataColumn("ProductNumber", typeof(string));
				DataColumn column5 = new DataColumn("InputMoney", typeof(string));
				DataColumn column6 = new DataColumn("ProductNumberOut", typeof(string));
				DataColumn column7 = new DataColumn("ProductNumberBalancer", typeof(string));
				DataColumn column8 = new DataColumn("BalancerMoney", typeof(string));
				DataColumn column9 = new DataColumn("ProductUnit", typeof(string));
				DataColumn column10 = new DataColumn("PossName", typeof(string));
				dataTable.Columns.Add(column);
				dataTable.Columns.Add(column2);
				dataTable.Columns.Add(column3);
				dataTable.Columns.Add(column4);
				dataTable.Columns.Add(column5);
				dataTable.Columns.Add(column6);
				dataTable.Columns.Add(column7);
				dataTable.Columns.Add(column8);
				dataTable.Columns.Add(column9);
				dataTable.Columns.Add(column10);
				SqlConnection sqlConnection = new SqlConnection(Program.strConnectionString);
				sqlConnection.Open();
				SqlParameter sqlParameter = new SqlParameter("objDate1", SqlDbType.DateTime);
				SqlParameter sqlParameter2 = new SqlParameter("objDate2", SqlDbType.DateTime);
				sqlParameter.Value = DateTime.Parse(this.txtfromDay.Value.ToString().Substring(0, 10) + " 00:00:00 AM");
				sqlParameter2.Value = DateTime.Parse(this.txttoDay.Value.ToString().Substring(0, 10) + " 11:59:59 PM");
				SqlCommand sqlCommand = sqlConnection.CreateCommand();
				sqlCommand.Parameters.Add(sqlParameter);
				sqlCommand.Parameters.Add(sqlParameter2);
				string str = "";
				if (this.currPossName.Trim() != "")
				{
					str = " AND [PossName] = N'" + this.currPossName + "'";
				}
				if (sqlQuery == "")
				{
					sqlCommand.CommandText = "SELECT * FROM [TabDetailBill],[TabBill] WHERE [TabDetailBill].[billID] = [TabBill].[ID] AND  [TypeInput] IN ('IN1','IN2','IN3') AND [TabBill].[CreateDate] BETWEEN @objDate1 AND @objDate2 " + str + " ORDER BY [ProductName]";
				}
				else
				{
					sqlCommand.CommandText = sqlQuery;
				}
				SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
				float num = 0f;
				int num2 = 0;
				while (sqlDataReader.Read())
				{
					float num3 = float.Parse(this.numOutput(sqlDataReader["Pid"].ToString(), sqlDataReader["Packet"].ToString()));
					float num4 = float.Parse(sqlDataReader["ProductNumber"].ToString()) - num3;
					num += num4 * float.Parse(sqlDataReader["ProductPrice"].ToString());
					if (!this.checkProductNameInDataGridView(sqlDataReader["ProductName"].ToString(), dataTable))
					{
						num2++;
						dataTable.Rows.Add(new object[]
						{
							sqlDataReader["Pid"].ToString(),
							sqlDataReader["ProductName"].ToString(),
							sqlDataReader["Packet"].ToString(),
							sqlDataReader["ProductNumber"].ToString(),
							string.Format(Program.lenAffterDecimal, float.Parse(sqlDataReader["ProductNumber"].ToString()) * float.Parse(sqlDataReader["ProductPrice"].ToString())),
							num3.ToString(),
							num4.ToString(),
							string.Format(Program.lenAffterDecimal, num4 * float.Parse(sqlDataReader["ProductPrice"].ToString())),
							" " + sqlDataReader["ProductUnit"].ToString(),
							sqlDataReader["PossName"].ToString()
						});
					}
					else
					{
						dataTable.Rows.Add(new object[]
						{
							sqlDataReader["Pid"].ToString(),
							"",
							sqlDataReader["Packet"].ToString(),
							sqlDataReader["ProductNumber"].ToString(),
							string.Format(Program.lenAffterDecimal, float.Parse(sqlDataReader["ProductNumber"].ToString()) * float.Parse(sqlDataReader["ProductPrice"].ToString())),
							num3.ToString(),
							num4.ToString(),
							string.Format(Program.lenAffterDecimal, num4 * float.Parse(sqlDataReader["ProductPrice"].ToString())),
							" " + sqlDataReader["ProductUnit"].ToString(),
							sqlDataReader["PossName"].ToString()
						});
					}
				}
				sqlDataReader.Close();
				sqlConnection.Close();
				sqlConnection.Dispose();
				this.btnPrint.Enabled = true;
				this.objTable = dataTable;
				this.dgvProduct.DataSource = this.objTable;
				this.lblCountItem.Text = string.Concat(new string[]
				{
					"Có ",
					num2.ToString(),
					" sản phẩm / ",
					this.objTable.Rows.Count.ToString(),
					" lô hàng"
				});
				if (this.objTable.Rows.Count > 0)
				{
					this.btnPrint.Enabled = true;
					this.btnExportToExcel.Enabled = true;
				}
				else
				{
					this.btnPrint.Enabled = false;
					this.btnExportToExcel.Enabled = false;
				}
				this.lblSumMoney.Text = string.Format(Program.lenAffterDecimal, num);
			}
			catch
			{
				this.btnPrint.Enabled = false;
				this.objTable = null;
				this.dgvProduct.DataSource = this.objTable;
			}
		}
		private bool checkProductNameInDataGridView(string pName, DataTable objTable)
		{
			bool result = false;
			for (int i = 0; i < objTable.Rows.Count; i++)
			{
				if (objTable.Rows[i]["ProductName"].ToString().ToUpper() == pName.ToUpper())
				{
					result = true;
				}
			}
			return result;
		}
		private string numOutput(string PID, string Packet)
		{
			string text = "0";
			SqlConnection sqlConnection = new SqlConnection(Program.strConnectionString);
			sqlConnection.Open();
			SqlCommand sqlCommand = sqlConnection.CreateCommand();
			sqlCommand.CommandText = string.Concat(new string[]
			{
				"SELECT SUM([productNumber]/Rate) AS [numOutput] FROM [TabDetailBill],[TabBill] WHERE [TabDetailBill].[billID] = [TabBill].[ID] AND [TypeInput] IN ('OUT1','OUT2','OUT3','OUT4') AND [TabDetailBill].[PID] = ",
				PID,
				" AND [TabDetailBill].[Packet] = '",
				Packet,
				"'"
			});
			SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
			if (sqlDataReader.HasRows)
			{
				while (sqlDataReader.Read())
				{
					text = sqlDataReader["numOutput"].ToString();
				}
			}
			else
			{
				text = "0";
			}
			sqlDataReader.Close();
			sqlConnection.Close();
			sqlConnection.Dispose();
			if (text.Trim() == "")
			{
				text = "0";
			}
			return text;
		}
		private void btnSearch_Click(object sender, EventArgs e)
		{
			this.getDetailBalancer("");
		}
		private void resetDataGridView()
		{
			this.objTable = null;
			this.dgvProduct.DataSource = this.objTable;
			this.btnPrint.Enabled = false;
		}
		private void btnPrint_Click_1(object sender, EventArgs e)
		{
			frmRepInventory.objTable = new DataTable();
			frmRepInvenrotyView frmRepInvenrotyView = new frmRepInvenrotyView();
			frmRepInvenrotyView.dateTime = "Từ " + this.txtfromDay.Text + " đến " + this.txttoDay.Text;
			if (this.cbbParentGID.SelectedValue.ToString() != "0")
			{
				frmRepInvenrotyView.productGroup = "Nhóm hàng hoá : " + this.cbbParentGID.Text;
			}
			else
			{
				frmRepInvenrotyView.productGroup = "Nhóm hàng hoá : Tất cả";
			}
			frmRepInventory.objTable = this.objTable;
			frmRepInvenrotyView.ShowDialog();
		}
		private void txtSearch_KeyDown(object sender, KeyEventArgs e)
		{
			if (this.txtSearch.Text != "")
			{
				if (e.KeyCode == Keys.Return)
				{
					string text = "";
					if (this.currPossName.Trim() != "")
					{
						text = " AND [PossName] = N'" + this.currPossName + "'";
					}
					this.getDetailBalancer(string.Concat(new string[]
					{
						"SELECT * FROM [TabDetailBill],[TabBill] WHERE [TabDetailBill].[billID] = [TabBill].[ID] AND  [TypeInput] IN ('IN1','IN2','IN3') AND [TabBill].[CreateDate] BETWEEN @objDate1 AND @objDate2 AND [TabDetailBill].[ProductName] LIKE N'%",
						this.txtSearch.Text.ToUpper(),
						"%'",
						text,
						"  ORDER BY [ProductName]"
					}));
				}
			}
		}
		private void txtfromDay_ValueChanged(object sender, EventArgs e)
		{
		}
		private void txttoDay_ValueChanged(object sender, EventArgs e)
		{
		}
		private void btnExportToExcel_Click(object sender, EventArgs e)
		{
			try
			{
				frmRepInventory.objTable = new DataTable();
				frmRepInventory.objTable = this.objTable;
				ActiveReport3 activeReport = new frmRepInventory();
				activeReport.Run();
				XlsExport xlsExport = new XlsExport();
				SaveFileDialog saveFileDialog = new SaveFileDialog();
				saveFileDialog.ShowDialog();
				string text = saveFileDialog.FileName;
				if (text != "")
				{
					if (!text.ToUpper().Contains(".XLS"))
					{
						text += ".xls";
					}
					xlsExport.Export(activeReport.Document, text);
					MessageBox.Show("Hệ thống đã hoàn thành việc xuất dữ liệu ra file Excel", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
				}
				else
				{
					MessageBox.Show("Bạn chưa chọn đường dẫn và tên file cần xuất!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
				}
			}
			catch
			{
			}
		}
		private void ckbShowPossName_CheckedChanged(object sender, EventArgs e)
		{
			this.dgvProduct.Columns["PossName"].Visible = this.ckbShowPossName.Checked;
		}
		private void loadPossition()
		{
			this.tvPossition.Nodes.Clear();
			string text = "";
			SqlConnection sqlConnection = new SqlConnection(this.objFunc.strConnectionString);
			sqlConnection.Open();
			if (text == "")
			{
				text = "SELECT * FROM [TabPossition] ORDER BY [Name]";
			}
			SqlCommand sqlCommand = new SqlCommand(text, sqlConnection);
			SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
			TreeNode treeNode = new TreeNode();
			treeNode = new TreeNode("Bố trí nhà thuốc - ngăn thuốc");
			treeNode.Name = "0";
			treeNode.ImageIndex = 2;
			treeNode.SelectedImageIndex = 2;
			treeNode.ExpandAll();
			if (sqlDataReader.HasRows)
			{
				while (sqlDataReader.Read())
				{
					TreeNode treeNode2 = new TreeNode();
					treeNode2.ImageIndex = 0;
					treeNode2.SelectedImageIndex = 1;
					treeNode2.ExpandAll();
					treeNode2.ForeColor = Color.Blue;
					treeNode2.Text = sqlDataReader["Name"].ToString();
					treeNode2.Name = sqlDataReader["Name"].ToString();
					treeNode.Nodes.Add(treeNode2);
				}
			}
			sqlDataReader.Close();
			sqlDataReader.Dispose();
			this.tvPossition.Nodes.Add(treeNode);
			sqlConnection.Close();
			sqlConnection.Dispose();
		}
		private void tvPossition_AfterSelect(object sender, TreeViewEventArgs e)
		{
			try
			{
				this.currPossName = this.tvPossition.SelectedNode.Name;
				this.getDetailBalancer("");
			}
			catch
			{
			}
		}
		private void dgvProduct_CellClick(object sender, DataGridViewCellEventArgs e)
		{
			try
			{
				this.lblCurrPoss.Text = this.dgvProduct.Rows[e.RowIndex].Cells["PossName"].Value.ToString();
				this.currPid = this.dgvProduct.Rows[e.RowIndex].Cells["Column9"].Value.ToString();
			}
			catch
			{
				this.lblCurrPoss.Text = "-:-";
				this.currPid = "0";
			}
		}
		private void btnForward_Click(object sender, EventArgs e)
		{
			products products = new products();
			products.forWardPossition(this.currPid, this.cbbPossition.SelectedValue.ToString(), this.cbbPossition.Text);
			MessageBox.Show("Vị trí lưu trữ thuốc đã được chuyển sang vị trí mới \r\n\r\n" + this.cbbPossition.Text, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
		}
		private void showWatting()
		{
			this.objW = new frmWaitting();
			this.objW.ShowDialog();
			Thread.Sleep(40);
		}
		private void btnSearch_Click_1(object sender, EventArgs e)
		{
			if (this.txtSearch.Text != "")
			{
				string text = "";
				if (this.currPossName.Trim() != "")
				{
					text = " AND [PossName] = N'" + this.currPossName + "'";
				}
				this.getDetailBalancer(string.Concat(new string[]
				{
					"SELECT * FROM [TabDetailBill],[TabBill] WHERE [TabDetailBill].[billID] = [TabBill].[ID] AND  [TypeInput] IN ('IN1','IN2','IN3') AND [TabBill].[CreateDate] BETWEEN @objDate1 AND @objDate2 AND [TabDetailBill].[ProductName] LIKE N'%",
					this.txtSearch.Text.ToUpper(),
					"%'",
					text,
					"  ORDER BY [ProductName]"
				}));
			}
		}
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
			this.components = new Container();
			DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle4 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle5 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle6 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle7 = new DataGridViewCellStyle();
			ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(frmInventory));
			this.dgvProduct = new DataGridView();
			this.Column2 = new DataGridViewTextBoxColumn();
			this.Column1 = new DataGridViewTextBoxColumn();
			this.Column4 = new DataGridViewTextBoxColumn();
			this.Column8 = new DataGridViewTextBoxColumn();
			this.Column5 = new DataGridViewTextBoxColumn();
			this.Column6 = new DataGridViewTextBoxColumn();
			this.Column7 = new DataGridViewTextBoxColumn();
			this.Column3 = new DataGridViewTextBoxColumn();
			this.Column9 = new DataGridViewTextBoxColumn();
			this.PossName = new DataGridViewTextBoxColumn();
			this.btnClose = new Button();
			this.groupBox1 = new GroupBox();
			this.btnSearch = new Button();
			this.txtSearch = new System.Windows.Forms.TextBox();
			this.label4 = new System.Windows.Forms.Label();
			this.txttoDay = new DateTimePicker();
			this.label3 = new System.Windows.Forms.Label();
			this.txtfromDay = new DateTimePicker();
			this.cbbParentGID = new ComboBox();
			this.label1 = new System.Windows.Forms.Label();
			this.ckbShowPossName = new System.Windows.Forms.CheckBox();
			this.btnPrint = new Button();
			this.btnExportToExcel = new Button();
			this.lblCountItem = new System.Windows.Forms.Label();
			this.tvPossition = new TreeView();
			this.imageList1 = new ImageList(this.components);
			this.cbbPossition = new ComboBox();
			this.label5 = new System.Windows.Forms.Label();
			this.btnForward = new Button();
			this.lblCurrPoss = new System.Windows.Forms.Label();
			this.lblSumMoney = new System.Windows.Forms.Label();
			this.label7 = new System.Windows.Forms.Label();
			this.label6 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			((ISupportInitialize)this.dgvProduct).BeginInit();
			this.groupBox1.SuspendLayout();
			base.SuspendLayout();
			this.dgvProduct.AllowUserToAddRows = false;
			this.dgvProduct.AllowUserToDeleteRows = false;
			this.dgvProduct.AllowUserToOrderColumns = true;
			this.dgvProduct.AllowUserToResizeColumns = false;
			this.dgvProduct.AllowUserToResizeRows = false;
			dataGridViewCellStyle.BackColor = Color.FromArgb(192, 255, 255);
			dataGridViewCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle;
			this.dgvProduct.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.dgvProduct.BackgroundColor = Color.White;
			this.dgvProduct.BorderStyle = BorderStyle.Fixed3D;
			this.dgvProduct.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
			this.dgvProduct.Columns.AddRange(new DataGridViewColumn[]
			{
				this.Column2,
				this.Column1,
				this.Column4,
				this.Column8,
				this.Column5,
				this.Column6,
				this.Column7,
				this.Column3,
				this.Column9,
				this.PossName
			});
			this.dgvProduct.Cursor = Cursors.Hand;
			this.dgvProduct.EnableHeadersVisualStyles = false;
			this.dgvProduct.Location = new System.Drawing.Point(249, 72);
			this.dgvProduct.MultiSelect = false;
			this.dgvProduct.Name = "dgvProduct";
			this.dgvProduct.ReadOnly = true;
			this.dgvProduct.RowHeadersVisible = false;
			this.dgvProduct.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
			this.dgvProduct.RowTemplate.DefaultCellStyle.BackColor = Color.White;
			this.dgvProduct.RowTemplate.DefaultCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvProduct.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
			this.dgvProduct.Size = new Size(694, 460);
			this.dgvProduct.TabIndex = 1;
			this.dgvProduct.CellClick += new DataGridViewCellEventHandler(this.dgvProduct_CellClick);
			this.Column2.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
			this.Column2.DataPropertyName = "productName";
			dataGridViewCellStyle2.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.Column2.DefaultCellStyle = dataGridViewCellStyle2;
			this.Column2.HeaderText = "Sản phẩm";
			this.Column2.MinimumWidth = 90;
			this.Column2.Name = "Column2";
			this.Column2.ReadOnly = true;
			this.Column2.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column1.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column1.DataPropertyName = "Packet";
			this.Column1.HeaderText = "Số lô";
			this.Column1.MinimumWidth = 90;
			this.Column1.Name = "Column1";
			this.Column1.ReadOnly = true;
			this.Column1.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column1.Width = 90;
			this.Column4.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column4.DataPropertyName = "productNumber";
			dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle3.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 0);
			dataGridViewCellStyle3.ForeColor = Color.Blue;
			dataGridViewCellStyle3.Format = "N0";
			dataGridViewCellStyle3.NullValue = null;
			this.Column4.DefaultCellStyle = dataGridViewCellStyle3;
			this.Column4.HeaderText = "SL Nhập";
			this.Column4.MinimumWidth = 80;
			this.Column4.Name = "Column4";
			this.Column4.ReadOnly = true;
			this.Column4.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column4.Width = 80;
			this.Column8.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column8.DataPropertyName = "InputMoney";
			dataGridViewCellStyle4.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle4.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 0);
			dataGridViewCellStyle4.ForeColor = Color.Blue;
			dataGridViewCellStyle4.Format = "N0";
			dataGridViewCellStyle4.NullValue = null;
			this.Column8.DefaultCellStyle = dataGridViewCellStyle4;
			this.Column8.HeaderText = "Thành tiền";
			this.Column8.MinimumWidth = 90;
			this.Column8.Name = "Column8";
			this.Column8.ReadOnly = true;
			this.Column8.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column8.Width = 90;
			this.Column5.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column5.DataPropertyName = "ProductNumberOut";
			dataGridViewCellStyle5.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle5.Format = "N0";
			dataGridViewCellStyle5.NullValue = null;
			this.Column5.DefaultCellStyle = dataGridViewCellStyle5;
			this.Column5.HeaderText = "SL Xuất";
			this.Column5.MinimumWidth = 75;
			this.Column5.Name = "Column5";
			this.Column5.ReadOnly = true;
			this.Column5.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column5.Width = 75;
			this.Column6.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column6.DataPropertyName = "ProductNumberBalancer";
			dataGridViewCellStyle6.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle6.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 0);
			dataGridViewCellStyle6.ForeColor = Color.Red;
			dataGridViewCellStyle6.Format = "N0";
			dataGridViewCellStyle6.NullValue = null;
			this.Column6.DefaultCellStyle = dataGridViewCellStyle6;
			this.Column6.HeaderText = "SL Tồn";
			this.Column6.MinimumWidth = 80;
			this.Column6.Name = "Column6";
			this.Column6.ReadOnly = true;
			this.Column6.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column6.Width = 80;
			this.Column7.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column7.DataPropertyName = "BalancerMoney";
			dataGridViewCellStyle7.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle7.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 0);
			dataGridViewCellStyle7.ForeColor = Color.Red;
			dataGridViewCellStyle7.Format = "N0";
			dataGridViewCellStyle7.NullValue = null;
			this.Column7.DefaultCellStyle = dataGridViewCellStyle7;
			this.Column7.HeaderText = "Thành tiền";
			this.Column7.MinimumWidth = 90;
			this.Column7.Name = "Column7";
			this.Column7.ReadOnly = true;
			this.Column7.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column7.Width = 90;
			this.Column3.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column3.DataPropertyName = "productUnit";
			this.Column3.HeaderText = "Đơn vị tính";
			this.Column3.MinimumWidth = 90;
			this.Column3.Name = "Column3";
			this.Column3.ReadOnly = true;
			this.Column3.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column3.Width = 90;
			this.Column9.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column9.DataPropertyName = "Pid";
			this.Column9.HeaderText = "Mã sản phẩm";
			this.Column9.Name = "Column9";
			this.Column9.ReadOnly = true;
			this.Column9.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column9.Visible = false;
			this.PossName.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.PossName.DataPropertyName = "PossName";
			this.PossName.HeaderText = "Vị trí";
			this.PossName.MinimumWidth = 130;
			this.PossName.Name = "PossName";
			this.PossName.ReadOnly = true;
			this.PossName.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.PossName.Visible = false;
			this.PossName.Width = 130;
			this.btnClose.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.btnClose.FlatAppearance.BorderColor = Color.FromArgb(255, 128, 255);
			this.btnClose.FlatStyle = FlatStyle.Flat;
			this.btnClose.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnClose.Location = new System.Drawing.Point(846, 568);
			this.btnClose.Name = "btnClose";
			this.btnClose.Size = new Size(96, 26);
			this.btnClose.TabIndex = 38;
			this.btnClose.Text = "Thoát  [ ESC ]";
			this.btnClose.UseVisualStyleBackColor = true;
			this.btnClose.Click += new EventHandler(this.btnClose_Click);
			this.groupBox1.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.groupBox1.Controls.Add(this.btnSearch);
			this.groupBox1.Controls.Add(this.txtSearch);
			this.groupBox1.Controls.Add(this.label4);
			this.groupBox1.Controls.Add(this.txttoDay);
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Controls.Add(this.txtfromDay);
			this.groupBox1.Controls.Add(this.cbbParentGID);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.groupBox1.Location = new System.Drawing.Point(7, 8);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new Size(936, 58);
			this.groupBox1.TabIndex = 39;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "Điều kiện kiểm kê";
			this.btnSearch.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.btnSearch.FlatAppearance.BorderColor = Color.Cyan;
			this.btnSearch.FlatStyle = FlatStyle.Flat;
			this.btnSearch.Location = new System.Drawing.Point(849, 18);
			this.btnSearch.Name = "btnSearch";
			this.btnSearch.Size = new Size(78, 25);
			this.btnSearch.TabIndex = 62;
			this.btnSearch.Text = "Tìm kiếm";
			this.btnSearch.UseVisualStyleBackColor = true;
			this.btnSearch.Click += new EventHandler(this.btnSearch_Click_1);
			this.txtSearch.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.txtSearch.BackColor = Color.White;
			this.txtSearch.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.txtSearch.Location = new System.Drawing.Point(564, 20);
			this.txtSearch.Name = "txtSearch";
			this.txtSearch.Size = new Size(279, 22);
			this.txtSearch.TabIndex = 61;
			this.txtSearch.KeyDown += new KeyEventHandler(this.txtSearch_KeyDown);
			this.label4.AutoSize = true;
			this.label4.Location = new System.Drawing.Point(169, 24);
			this.label4.Name = "label4";
			this.label4.Size = new Size(11, 15);
			this.label4.TabIndex = 59;
			this.label4.Text = "-";
			this.txttoDay.CustomFormat = "dd/MM/yyyy";
			this.txttoDay.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.txttoDay.Format = DateTimePickerFormat.Custom;
			this.txttoDay.Location = new System.Drawing.Point(184, 21);
			this.txttoDay.Name = "txttoDay";
			this.txttoDay.Size = new Size(100, 21);
			this.txttoDay.TabIndex = 58;
			this.txttoDay.ValueChanged += new EventHandler(this.txttoDay_ValueChanged);
			this.label3.AutoSize = true;
			this.label3.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.label3.Location = new System.Drawing.Point(6, 24);
			this.label3.Name = "label3";
			this.label3.Size = new Size(57, 15);
			this.label3.TabIndex = 57;
			this.label3.Text = "Từ ngày :";
			this.txtfromDay.CustomFormat = "dd/MM/yyyy";
			this.txtfromDay.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.txtfromDay.Format = DateTimePickerFormat.Custom;
			this.txtfromDay.Location = new System.Drawing.Point(66, 21);
			this.txtfromDay.Name = "txtfromDay";
			this.txtfromDay.Size = new Size(100, 21);
			this.txtfromDay.TabIndex = 56;
			this.txtfromDay.ValueChanged += new EventHandler(this.txtfromDay_ValueChanged);
			this.cbbParentGID.BackColor = Color.White;
			this.cbbParentGID.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbbParentGID.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.cbbParentGID.FormattingEnabled = true;
			this.cbbParentGID.Location = new System.Drawing.Point(364, 20);
			this.cbbParentGID.Name = "cbbParentGID";
			this.cbbParentGID.Size = new Size(195, 23);
			this.cbbParentGID.TabIndex = 40;
			this.cbbParentGID.SelectedIndexChanged += new EventHandler(this.cbbParentGID_SelectedIndexChanged);
			this.label1.AutoSize = true;
			this.label1.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.label1.Location = new System.Drawing.Point(290, 24);
			this.label1.Name = "label1";
			this.label1.Size = new Size(70, 15);
			this.label1.TabIndex = 41;
			this.label1.Text = "Loại thuốc :";
			this.ckbShowPossName.BackColor = SystemColors.ControlLight;
			this.ckbShowPossName.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.ckbShowPossName.Location = new System.Drawing.Point(11, 71);
			this.ckbShowPossName.Name = "ckbShowPossName";
			this.ckbShowPossName.Size = new Size(229, 19);
			this.ckbShowPossName.TabIndex = 59;
			this.ckbShowPossName.Text = "Hiện vị trí thuốc trong kho";
			this.ckbShowPossName.UseVisualStyleBackColor = false;
			this.ckbShowPossName.CheckedChanged += new EventHandler(this.ckbShowPossName_CheckedChanged);
			this.btnPrint.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.btnPrint.Enabled = false;
			this.btnPrint.FlatAppearance.BorderColor = Color.FromArgb(255, 128, 255);
			this.btnPrint.FlatStyle = FlatStyle.Flat;
			this.btnPrint.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnPrint.Location = new System.Drawing.Point(640, 568);
			this.btnPrint.Name = "btnPrint";
			this.btnPrint.Size = new Size(102, 26);
			this.btnPrint.TabIndex = 40;
			this.btnPrint.Text = "Xem và in [ F7 ]";
			this.btnPrint.UseVisualStyleBackColor = true;
			this.btnPrint.Click += new EventHandler(this.btnPrint_Click_1);
			this.btnExportToExcel.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.btnExportToExcel.Enabled = false;
			this.btnExportToExcel.FlatAppearance.BorderColor = Color.FromArgb(255, 128, 255);
			this.btnExportToExcel.FlatStyle = FlatStyle.Flat;
			this.btnExportToExcel.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnExportToExcel.Location = new System.Drawing.Point(743, 568);
			this.btnExportToExcel.Name = "btnExportToExcel";
			this.btnExportToExcel.Size = new Size(102, 26);
			this.btnExportToExcel.TabIndex = 46;
			this.btnExportToExcel.Text = "Xuất file Excel";
			this.btnExportToExcel.UseVisualStyleBackColor = true;
			this.btnExportToExcel.Click += new EventHandler(this.btnExportToExcel_Click);
			this.lblCountItem.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.lblCountItem.BackColor = Color.White;
			this.lblCountItem.BorderStyle = BorderStyle.Fixed3D;
			this.lblCountItem.Location = new System.Drawing.Point(7, 568);
			this.lblCountItem.Name = "lblCountItem";
			this.lblCountItem.Size = new Size(233, 24);
			this.lblCountItem.TabIndex = 58;
			this.lblCountItem.Text = "-:-";
			this.lblCountItem.TextAlign = ContentAlignment.MiddleLeft;
			this.tvPossition.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left);
			this.tvPossition.ImageIndex = 0;
			this.tvPossition.ImageList = this.imageList1;
			this.tvPossition.Location = new System.Drawing.Point(7, 90);
			this.tvPossition.Name = "tvPossition";
			this.tvPossition.SelectedImageIndex = 0;
			this.tvPossition.Size = new Size(233, 470);
			this.tvPossition.TabIndex = 130;
			this.tvPossition.AfterSelect += new TreeViewEventHandler(this.tvPossition_AfterSelect);
//			this.imageList1.ImageStream = (ImageListStreamer)componentResourceManager.GetObject("imageList1.ImageStream");
			this.imageList1.TransparentColor = Color.Transparent;
			this.imageList1.Images.SetKeyName(0, "layout_join_vertical.png");
			this.imageList1.Images.SetKeyName(1, "31.png");
			this.imageList1.Images.SetKeyName(2, "45.png");
			this.cbbPossition.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.cbbPossition.BackColor = Color.White;
			this.cbbPossition.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbbPossition.FlatStyle = FlatStyle.Flat;
			this.cbbPossition.Font = new Font("Arial", 6.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.cbbPossition.FormattingEnabled = true;
			this.cbbPossition.ItemHeight = 12;
			this.cbbPossition.Location = new System.Drawing.Point(437, 537);
			this.cbbPossition.Name = "cbbPossition";
			this.cbbPossition.Size = new Size(160, 20);
			this.cbbPossition.TabIndex = 132;
			this.label5.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
            //this.label5.Image = (Image)componentResourceManager.GetObject("label5.Image");
			this.label5.Location = new System.Drawing.Point(413, 535);
			this.label5.Name = "label5";
			this.label5.Size = new Size(20, 25);
			this.label5.TabIndex = 133;
			this.btnForward.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.btnForward.FlatAppearance.BorderColor = Color.FromArgb(255, 128, 255);
			this.btnForward.FlatStyle = FlatStyle.Flat;
			this.btnForward.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnForward.Location = new System.Drawing.Point(249, 568);
			this.btnForward.Name = "btnForward";
			this.btnForward.Size = new Size(348, 26);
			this.btnForward.TabIndex = 134;
			this.btnForward.Text = "Chuyển sản phẩm đến vị trí đã chọn";
			this.btnForward.UseVisualStyleBackColor = true;
			this.btnForward.Click += new EventHandler(this.btnForward_Click);
			this.lblCurrPoss.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.lblCurrPoss.BackColor = Color.White;
			this.lblCurrPoss.BorderStyle = BorderStyle.Fixed3D;
			this.lblCurrPoss.Location = new System.Drawing.Point(249, 536);
			this.lblCurrPoss.Name = "lblCurrPoss";
			this.lblCurrPoss.Size = new Size(160, 20);
			this.lblCurrPoss.TabIndex = 135;
			this.lblCurrPoss.Text = "-:-";
			this.lblCurrPoss.TextAlign = ContentAlignment.MiddleLeft;
			this.lblSumMoney.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.lblSumMoney.BackColor = Color.White;
			this.lblSumMoney.BorderStyle = BorderStyle.Fixed3D;
			this.lblSumMoney.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.lblSumMoney.Location = new System.Drawing.Point(745, 536);
			this.lblSumMoney.Name = "lblSumMoney";
			this.lblSumMoney.Size = new Size(89, 20);
			this.lblSumMoney.TabIndex = 136;
			this.lblSumMoney.Text = "-:-";
			this.lblSumMoney.TextAlign = ContentAlignment.MiddleRight;
			this.label7.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.label7.BorderStyle = BorderStyle.FixedSingle;
			this.label7.Location = new System.Drawing.Point(249, 561);
			this.label7.Name = "label7";
			this.label7.Size = new Size(694, 1);
			this.label7.TabIndex = 138;
			this.label6.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.label6.BackColor = Color.White;
			this.label6.BorderStyle = BorderStyle.Fixed3D;
			this.label6.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.label6.Location = new System.Drawing.Point(836, 536);
			this.label6.Name = "label6";
			this.label6.Size = new Size(88, 20);
			this.label6.TabIndex = 139;
			this.label6.Text = "-:-";
			this.label6.TextAlign = ContentAlignment.MiddleLeft;
			this.label2.BackColor = SystemColors.ControlLight;
			this.label2.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.label2.Location = new System.Drawing.Point(7, 71);
			this.label2.Name = "label2";
			this.label2.Size = new Size(233, 19);
			this.label2.TabIndex = 63;
			base.AutoScaleDimensions = new SizeF(7f, 15f);
			//base.AutoScaleMode = AutoScaleMode.Font;
			this.BackColor = Color.White;
			base.ClientSize = new Size(950, 600);
			base.Controls.Add(this.label6);
			base.Controls.Add(this.label7);
			base.Controls.Add(this.lblSumMoney);
			base.Controls.Add(this.lblCurrPoss);
			base.Controls.Add(this.btnForward);
			base.Controls.Add(this.label5);
			base.Controls.Add(this.cbbPossition);
			base.Controls.Add(this.tvPossition);
			base.Controls.Add(this.lblCountItem);
			base.Controls.Add(this.btnExportToExcel);
			base.Controls.Add(this.btnPrint);
			base.Controls.Add(this.groupBox1);
			base.Controls.Add(this.btnClose);
			base.Controls.Add(this.dgvProduct);
			base.Controls.Add(this.ckbShowPossName);
			base.Controls.Add(this.label2);
			this.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 0);
			//base.Icon = (System.Drawing.Icon)componentResourceManager.GetObject("$this.Icon");
			//base.Icon = (Icon)componentResourceManager.GetObject("$this.Icon");
			base.KeyPreview = true;
			base.Name = "frmInventory";
			base.ShowInTaskbar = false;
			base.StartPosition = FormStartPosition.CenterScreen;
			this.Text = "KIỂM KÊ HÀNG HOÁ";
			base.WindowState = FormWindowState.Maximized;
			base.Load += new EventHandler(this.frmInput_Load);
			base.KeyDown += new KeyEventHandler(this.frmInput_KeyDown);
			((ISupportInitialize)this.dgvProduct).EndInit();
			this.groupBox1.ResumeLayout(false);
			this.groupBox1.PerformLayout();
			base.ResumeLayout(false);
		}
	}
}
